//
//  QPerfectTextViewCell.m
//  QoilPublic
//
//  Created by 杨凯 on 16/11/23.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QPerfectTextViewCell.h"

@interface QPerfectTextViewCell()<UITextViewDelegate>

@property (weak, nonatomic) IBOutlet UITextView *textView;


@property (weak, nonatomic) IBOutlet UILabel *titleLabel;


@end
@implementation QPerfectTextViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
   
    _textView.delegate = self;
}

#pragma mark --- textView delegate
- (void)textViewDidChange:(UITextView *)textView {
    
    if(textView.text.length == 0){
        _titleLabel.hidden = NO;
    }else{
        _titleLabel.hidden = YES;
    }
    
    if (textView.text.length > 100){
        textView.text = [textView.text substringToIndex:100];
    }
    if(self.block){
        self.block(_textView.text);
    }
}




@end
